home *** CD-ROM | disk | FTP | other *** search
/ ...taking it to the Macs! / ...taking it to the Macs!.iso / Extras / ActiveX Mac SDK / ActiveX SDK / Sample Controls / BDiamond / FnAssert.cpp < prev    next >
Encoding:
Text File  |  1996-12-20  |  1.1 KB  |  52 lines  |  [TEXT/CWIE]

  1. ///////////////////////////////////////////////////////////////////////////////
  2. //
  3. //    This file is a BDIAMOND addition.
  4. //
  5.  
  6. #include "ocheaders.h"
  7. #include "FnAssert.h"
  8. #include "CError.h"
  9.  
  10. ///////////////////////////////////////////////////////////////////////////////
  11. //
  12. //    ASSERT
  13. //
  14.  
  15. #ifdef _DEBUG
  16. void ASSERT(Boolean expression, char * lpstrMsg)
  17. {
  18.     FnAssert((char *)expression, lpstrMsg, NULL, NULL);
  19. }
  20. #endif // _DEBUG
  21.  
  22. ///////////////////////////////////////////////////////////////////////////////
  23. //
  24. //    FnAssert
  25. //
  26.  
  27. #ifdef _DEBUG
  28. STDAPI FnAssert(char * lpstrExpr, char * lpstrMsg, char * lpstrFileName, unsigned short iLine)
  29. {
  30.  
  31. #pragma unused ( lpstrFileName, iLine )
  32.  
  33.     HRESULT            returnValue = ResultFromScode(S_OK);
  34.     
  35.     if ( lpstrExpr == NULL )
  36.     {
  37.         SysBeep(5); // awaken the developer
  38.         
  39.         c2pstr((char *)lpstrMsg);
  40.         DebugStr((StringPtr)lpstrMsg);
  41.         p2cstr((StringPtr)lpstrMsg);
  42.         
  43.         throw CError(FAILED_ASSERTION_ERROR); // CError just tosses it again, so we should terminate
  44.         // no return
  45.     }
  46.     else
  47.         returnValue = ResultFromScode(S_OK);
  48.     
  49.     return returnValue;
  50. }
  51. #endif // _DEBUG
  52.